﻿Imports System.Text
Imports D2L.Extensibility.AuthSdk
Imports RestSharp
Imports D2L.Extensibility.AuthSdk.Restsharp

<TestClass()>
Public Class UsersTeste

    Private _authObj As Authenticate.Authenticate = New Authenticate.Authenticate()
    Protected method As Authenticate.Service

    ''http://docs.valence.desire2learn.com/res/user.html#User.User
    ''http://docs.valence.desire2learn.com/res/user.html#get--d2l-api-lp-(version)-users-
    'Protected Const ROUTE_USERS As String = "/d2l/api/lp/" + UsersTeste.LP_VERSION + "/users/"

    ''http://docs.valence.desire2learn.com/res/user.html#User.UserProfile
    ''http://docs.valence.desire2learn.com/res/user.html#get--d2l-api-lp-(version)-profile-myProfile
    'Protected Const ROUTE_USER_PROFILE As String = "/d2l/api/lp/" + UsersTeste.LP_VERSION + "/profile/myProfile"

    <TestMethod()>
    Public Sub get_users()

        method = New Authenticate.Service

        Dim _response As RestSharp.IRestResponse(Of User.User) = _authObj.ExecuteService_with_UserContext(method.GetUsers, RestSharp.Method.GET, Type.User)

        Console.WriteLine("{0}{1}", "Response:", _response.ToString())
        Console.WriteLine("Response Content: {0}", _response.Content.ToString())

        Assert.IsNotNull(_response)
        Assert.AreEqual("OK", _response.StatusCode.ToString())

    End Sub

    <TestMethod()>
    Public Sub get_user_profile()

        method = New Authenticate.Service

        Dim _response As RestSharp.IRestResponse(Of User.UserProfile) = _authObj.ExecuteService_with_UserContext(method.GetUserProfile, RestSharp.Method.GET, Type.UserProfile)

        Console.WriteLine("{0}{1}", "Response:", _response.ToString())
        Console.WriteLine("Response Content: {0}", _response.Content.ToString())

        Assert.IsNotNull(_response)
        Assert.AreEqual("OK", _response.StatusCode.ToString())

    End Sub

End Class
